// Bellow of the comment block
function makeThread() {
	var pageURL = window.location.href,
		cb = document.getElementById('cm_block'),
		cbContent = cb.innerHTML,
		cmItemId = [],
		cmItemContent = [],
		cmItemLevel = [],
		cmNum = 0,
		cmItemId_T = '',
		cmItemContent_T = '',
		cmItemLevel_T = '',
		h = 0, i = 0, j = 0, k = 0,
		skeleton = '',
		str_T1 = "", str_T2 = "";

	function getInternetExplorerVersion() {
		var rv = -1;
		if (navigator.appName == 'Microsoft Internet Explorer') {
			var ua = navigator.userAgent;
			var re = new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");
			if (re.exec(ua) !== null) rv = parseFloat(RegExp.$1);
		}
		return rv;
	}
	var getIE_ver = getInternetExplorerVersion();
	if (getIE_ver == -1 || getIE_ver >= 9) {
		while (cbContent.indexOf('id="c') != -1) {
			i = cbContent.indexOf('id="c');
			cbContent = cbContent.substring(i + 4);
			i = cbContent.indexOf('"');
			cmItemId[cmNum] = cbContent.substring(0, i);
			cbContent = cbContent.substring(i);
			cmItemContent[cmNum] = document.getElementById(cmItemId[cmNum]).innerHTML;
			cmItemLevel[cmNum] = 0;
			cmNum++;
		}
		for (i = 0; i < cmNum - 1; i++) {
			for (j = i + 1; j < cmNum; j++) {
				if (cmItemContent[j].indexOf(cmItemId[i]) != -1) {
					cmItemId_T = cmItemId[j];
					cmItemContent_T = cmItemContent[j];
					cmItemLevel[j] = cmItemLevel[i] + 1;
					cmItemLevel_T = cmItemLevel[j];
					for (h = i + 1; h < j; h++) {
						if (cmItemLevel[h] < cmItemLevel_T) {
							break;
						}
					}
					for (k = j; k > h; k = k - 1) {
						cmItemId[k] = cmItemId[k - 1];
						cmItemContent[k] = cmItemContent[k - 1];
						cmItemLevel[k] = cmItemLevel[k - 1];
					}
					cmItemId[h] = cmItemId_T;
					cmItemContent[h] = cmItemContent_T;
					cmItemLevel[h] = cmItemLevel_T;
				}
			}
		}
		for (i = 0; i < cmNum; i++) {
			j = cmItemContent[i].indexOf('@<a href="#c');
			if (j != -1) {
				str_T1 = cmItemContent[i].substring(0, j);
				str_T2 = cmItemContent[i].substring(j + 1);
				j = str_T2.indexOf('</a>');
				str_T2 = str_T2.substring(j + 4);
				cmItemContent[i] = str_T1 + str_T2;
			}
			j = cmItemContent[i].indexOf('class="cm_wrap ');
			if (j != -1) {
				str_T1 = cmItemContent[i].substring(0, j);
				str_T2 = cmItemContent[i].substring(j);
				if (cmItemLevel[i] > 5) cmItemLevel[i] = 5;
				cmItemContent[i] = str_T1 + 'style="width:' + (100 - cmItemLevel[i] * 5) + '%" ' + str_T2;
			}
			skeleton += cmItemContent[i];
		}
		skeleton += '<div class="clear"></div>';
		cb.innerHTML = skeleton;
		cb.style.display = 'block';
		var cmTotalObj = document.getElementById('cm_total').innerHTML,
			cmTotal = parseInt(cmTotalObj, 10);
		if (cmTotal > 200) {
			skeleton = '<div style="float:left">Page ';
			var cmPageNum = (cmTotal - cmTotal % 200) / 200 + 1,
				orgUrlThreadCM = '',
				cmCurPage = 1;
			i = pageURL.indexOf('.html');
			if (i != -1) {
				orgUrlThreadCM = pageURL.substring(0, i + 5);
			} else {
				orgUrlThreadCM = pageURL;
			}
			i = orgUrlThreadCM.indexOf('#comments');
			if (i != -1) {
				orgUrlThreadCM = orgUrlThreadCM.substring(0, i);
			}
			i = pageURL.indexOf('?commentPage=');
			if (i == -1) {
				cmCurPage = 1;
			} else {
				cmCurPage = parseInt(pageURL.substring(i + 13), 10);
			}
			for (i = 1; i <= cmPageNum; i++) {
				if (i == cmCurPage) {
					skeleton += '<span>' + i + '</span>';
				} else {
					skeleton += '<a href="' + orgUrlThreadCM + '?commentPage=' + i + '#comments">' + i + '</a>';
				}
			}
			if (cmCurPage * 200 <= cmTotal) {
				skeleton += '</div><div style="float:right">' + (((cmCurPage - 1) * 200) + 1) + ' - ' + (cmCurPage * 200) + ' of ' + cmTotal + ' comments</div>';
			} else {
				skeleton += '</div><div style="float:right">' + (((cmCurPage - 1) * 200) + 1) + ' - ' + cmTotal + ' of ' + cmTotal + ' comments</div>';
			}
			var cmPageObj = document.getElementById('cm_page');
			cmPageObj.innerHTML = skeleton;
			cmPageObj = document.getElementById('cm_page_copy');
			cmPageObj.innerHTML = skeleton;
			if (cmCurPage < cmPageNum) {
				skeleton = '<style type="text/css">.cmauthor_reply {display: none}</style>';
				var cmReplyCSS = document.getElementById('cm_reply_css');
				cmReplyCSS.innerHTML = skeleton;
			}
		}
	} else {
		while (cbContent.indexOf('id=c') != -1) {
			i = cbContent.indexOf('id=c');
			cbContent = cbContent.substring(i + 3);
			i = cbContent.indexOf('>');
			cmItemId[cmNum] = cbContent.substring(0, i);
			cbContent = cbContent.substring(i);
			cmItemContent[cmNum] = document.getElementById(cmItemId[cmNum]).innerHTML;
			cmItemLevel[cmNum] = 0;
			cmNum++;
		}
		for (i = 0; i < cmNum - 1; i++) {
			for (j = i + 1; j < cmNum; j++) {
				if (cmItemContent[j].indexOf(cmItemId[i]) != -1) {
					cmItemId_T = cmItemId[j];
					cmItemContent_T = cmItemContent[j];
					cmItemLevel[j] = cmItemLevel[i] + 1;
					cmItemLevel_T = cmItemLevel[j];
					for (h = i + 1; h < j; h++) {
						if (cmItemLevel[h] < cmItemLevel_T) {
							break;
						}
					}
					for (k = j; k > h; k = k - 1) {
						cmItemId[k] = cmItemId[k - 1];
						cmItemContent[k] = cmItemContent[k - 1];
						cmItemLevel[k] = cmItemLevel[k - 1];
					}
					cmItemId[h] = cmItemId_T;
					cmItemContent[h] = cmItemContent_T;
					cmItemLevel[h] = cmItemLevel_T;
				}
			}
		}
		for (i = 0; i < cmNum; i++) {
			j = cmItemContent[i].indexOf('@<A href="#c');
			if (j != -1) {
				str_T1 = cmItemContent[i].substring(0, j);
				str_T2 = cmItemContent[i].substring(j + 1);
				j = str_T2.indexOf('</A>');
				str_T2 = str_T2.substring(j + 4);
				cmItemContent[i] = str_T1 + str_T2;
			}
			j = cmItemContent[i].indexOf('class=cm_wrap ');
			if (j != -1) {
				str_T1 = cmItemContent[i].substring(0, j);
				str_T2 = cmItemContent[i].substring(j);
				if (cmItemLevel[i] > 5) cmItemLevel[i] = 5;
				cmItemContent[i] = str_T1 + 'style="width:' + (100 - cmItemLevel[i] * 5) + '%" ' + str_T2;
			}
			skeleton += cmItemContent[i];
		}
		skeleton += '<div class="clear"></div>';
		cb.innerHTML = skeleton;
		cb.style.display = 'block';
		var cmTotalObj = document.getElementById('cm_total').innerHTML;
		var cmTotal = parseInt(cmTotalObj, 10);
		if (cmTotal > 200) {
			skeleton = '<div style="float:left">Page ';
			var cmPageNum = (cmTotal - cmTotal % 200) / 200 + 1;
			var orgUrlThreadCM = '';
			var cmCurPage = 1;
			i = pageURL.indexOf('.html');
			if (i != -1) {
				orgUrlThreadCM = pageURL.substring(0, i + 5);
			} else {
				orgUrlThreadCM = pageURL;
			}
			i = orgUrlThreadCM.indexOf('#comments');
			if (i != -1) {
				orgUrlThreadCM = orgUrlThreadCM.substring(0, i);
			}
			i = pageURL.indexOf('?commentPage=');
			if (i == -1) {
				cmCurPage = 1;
			} else {
				cmCurPage = parseInt(pageURL.substring(i + 13), 10);
			}
			for (i = 1; i <= cmPageNum; i++) {
				if (i == cmCurPage) {
					skeleton += '<span>' + i + '</span>';
				} else {
					skeleton += '<a href="' + orgUrlThreadCM + '?commentPage=' + i + '#comments">' + i + '</a>';
				}
			}
			if (cmCurPage * 200 <= cmTotal) {
				skeleton += '</div><div style="float:right">' + (((cmCurPage - 1) * 200) + 1) + ' - ' + (cmCurPage * 200) + ' of ' + cmTotal + ' comments</div>';
			} else {
				skeleton += '</div><div style="float:right">' + (((cmCurPage - 1) * 200) + 1) + ' - ' + cmTotal + ' of ' + cmTotal + ' comments</div>';
			}
			var cmPageObj = document.getElementById('cm_page');
			cmPageObj.innerHTML = skeleton;
			cmPageObj = document.getElementById('cm_page_copy');
			cmPageObj.innerHTML = skeleton;
			if (cmCurPage < cmPageNum) {
				skeleton = '<style type="text/css">.cm_author_reply {display: none}</style>';
				var cmReplyCSS = document.getElementById('cm_reply_css');
				cmReplyCSS.innerHTML = skeleton;
			}
		}
	}
} makeThread();

function replaceContent() {
	var a = document.getElementById('cm_block').innerHTML,
		b = "http://hompimpa.googlecode.com/svn/trunk/personal/emo/",
		c = " <img src='",
		d = "class='emo delayLoad'\/>";
	document.body.spellcheck = false;
	a = a.replace(/\@<a(.[^<]*)<\/a>/g, "");
	a = a.replace(/(<br ?\/?>)+(:|;|\^|=)/ig, "<br> $2");
	a = a.replace(/^(&nbsp;|<br ?\/?>| <br ?\/?>)+/ig, "");
	a = a.replace(/\s:\)/g, c + b + "smile.gif' alt=':)' " + d);
	a = a.replace(/\s;\)/g, c + b + "wink.gif' alt=';)' " + d);
	a = a.replace(/\s:D/g, c + b + "haha.gif' alt=':D' " + d);
	a = a.replace(/\s=D/g, c + b + "hihi.gif' alt='=D' " + d);
	a = a.replace(/\s\^:D/g, c + b + "abovemehaha.gif' alt='^:D' " + d);
	a = a.replace(/\s\^\_?\^/g, c + b + "senyum-tulus.gif' alt='^_^' " + d);
	a = a.replace(/\s:\(/g, c + b + "sad.gif' alt=':(' " + d);
	a = a.replace(/\s=\(/g, c + b + "sadanimated.gif' alt='=(' " + d);
	a = a.replace(/\s@@,/g, c + b + "rolleyes.gif' alt='@@,' " + d);
	a = a.replace(/\s:yaya:/ig, c + b + "yaya.gif' alt=':yaya:' " + d);
	a = a.replace(/\s:s/ig, c + b + "sullen.gif' alt=':s' " + d);
	a = a.replace(/\s:(\\|\/)/ig, c + b + "memble.gif' alt=':&#92;' " + d);
	a = a.replace(/\s:('|\&\#39\;)\(/g, c + b + "cry.gif' alt=':&#39;(' " + d);
	a = a.replace(/\s:waaa:/ig, c + b + "wawa.gif' alt=':waaa:' " + d);
	a = a.replace(/\sT\_T/ig, c + b + "tears.gif' alt='T_T' " + d);
	a = a.replace(/\sB\)/g, c + b + "cool.gif' alt='B)' " + d);
	a = a.replace(/\s:Q/g, c + b + "smoking.gif' alt=':Q' " + d);
	a = a.replace(/\s\*\*p/ig, c + b + "crazy.gif' alt='**p' " + d);
	a = a.replace(/\s7:\(/g, c + b + "conf.gif' alt='7:(' " + d);
	a = a.replace(/\s:p/ig, c + b + "wee.gif' alt=':p' " + d);
	a = a.replace(/\s:Oz+/ig, c + b + "sleep.gif' alt=':Ozz' " + d);
	a = a.replace(/\s7:O/ig, c + b + "angry.gif' alt='7:O' " + d);
	a = a.replace(/\s\\o\//ig, c + b + "applause.gif' alt='&#92;o/' " + d);
	a = a.replace(/\s\\m\//ig, c + b + "metal.gif' alt='&#92;m/' " + d);
	a = a.replace(/\s(&lt;3|:\*)/g, c + b + "love.gif' alt='&amp;amp;lt;3' " + d);
	a = a.replace(/\s0:\)/g, c + b + "angelgreen.gif' alt='0:)' " + d);
	a = a.replace(/\s\^o\^/ig, c + b + "angelwhite.gif' alt='^o^' " + d);
	a = a.replace(/\s:\-a/ig, c + b + "vomit.gif' alt=':-a' " + d);
	a = a.replace(/\s\*fck\*/ig, c + b + "fuck.gif' alt='*fck*' " + d);
	a = a.replace(/\sxV/ig, c + b + "demo.gif' alt='xV' " + d);
	a = a.replace(/\sx@/g, c + b + "marahbesar.gif' alt='x@' " + d);
	a = a.replace(/\sX@/ig, c + b + "arrgh.gif' alt='X@' " + d);
	a = a.replace(/\s:\-d/g, c + b + "top.gif' alt=':-d' " + d);
	a = a.replace(/\s:\-bd/g, c + b + "topmarkotop.gif' alt=':-bd' " + d);
	a = a.replace(/\s\~x\(+/ig, c + b + "ugh.gif' alt='~x(' " + d);
	a = a.replace(/\s:bye:/ig, c + b + "bye.gif' alt=':bye:' " + d);
	a = a.replace(/\s:W/g, c + b + "explain.gif' alt=':W' " + d);
	a = a.replace(/\s\(\-\.\-,\)/g, c + b + "pumpkin.gif' alt='(-.-,)' " + d);
	a = a.replace(/\s\*=p/ig, c + b + "ball1.gif' alt='*:p' " + d);
	a = a.replace(/\s=p\*/ig, c + b + "ball2.gif' alt=':p*' " + d);
	a = a.replace(/\s:(imhere|disini):/ig, c + b + "imhere.gif' alt=':disini:' " + d);
	a = a.replace(/\s:cendol:/ig, c + b + "cendol.gif' alt=':cendol:' " + d);
	a = a.replace(/\s&lt;:\)/g, c + b + "festival1.gif' alt='&amp;amp;lt;:)' " + d);
	a = a.replace(/\s&lt;=\)/g, c + b + "festival2.gif' alt='&amp;amp;lt;=)' " + d);
	a = a.replace(/\s:(rolled|guling):/ig, c + b + "rolled.gif' alt=':guling:' " + d);
	a = a.replace(/\s\*bang\*/ig, c + b + "bang.gif' alt='*bang*' " + d);
	a = a.replace(/\s\'\'J/ig, c + b + "call.gif' alt='&#39;&#39;J' " + d);
	a = a.replace(/\s:drummer:/ig, c + b + "drummer.gif' alt=':drummer:' " + d);
	a = a.replace(/\s:(guitarist|gitaris):/ig, c + b + "guitarist.gif' alt=':gitaris:' " + d);
	a = a.replace(/\s:(vocalist|vokalis):/ig, c + b + "vocalist.gif' alt=':vokalis:' " + d);
	a = a.replace(/<i rel="pre">(.[^<\/i>]*)<\/i>/ig, "<pre>$1<\/pre>");
	a = a.replace(/<i rel="code">(.[^>]*)<\/i>/ig, "<code>$1<\/code>");
	a = a.replace(/<b rel="h([1-6])">(.[^>]*)<\/b>(<br ?\/?>)?/ig, "<h$1>$2<\/h$1>");
	a = a.replace(/<b rel="quote">(.[^>]*)<\/b>/ig, "<blockquote>$1<\/blockquote>");
	a = a.replace(/<i rel="anchor">(.[^>]*)<\/i>/ig, "<a title=\"Untuk menyisipkan tautan dengan aman, gunakan pola &lt;i rel=&quot;anchor&quot;&gt;URL Anda&lt;/i&gt;\" class=\"allow\" href=\"$1\" target=\"_blank\">\[link\]<\/a><\/code>");
	a = a.replace(/<i rel=\"image\">(.[^>]*)<\/i>/ig, "<a title=\"Untuk menyisipkan gambar, gunakan pola &lt;i rel=&quot;image&quot;&gt;URL Gambar Anda&lt;/i&gt;\nKlik untuk memperbesar!\" class=\"allow center\" href=\"$1\" target=\"_blank\"><img class=\"center incomment\" src=\"$1\" alt=\"Loading...\"\/><\/a>");
	a = a.replace(/<em rel="note">(.[^>]*)<\/em>/ig, "<cite class=\"note\">$1<\/cite>");
	a = a.replace(/\[note\](.[^\]]*)\[\/note\]/ig, "<cite class=\"note\">$1<\/cite>");
	a = a.replace(/\[iframe\](.[^\]]*)\[\/iframe\]/ig, "<iframe class=\"loader video\" lsrc=\"$1\" frameborder=\"0\"><\/iframe>");
	a = a.replace(/src=(.[^\"]*)\/s1600(?=.[^\"]*\.(jpg|jpeg|gif|png|bmp))/ig, "src=$1\/s200");
	document.getElementById('cm_block').innerHTML = a;
} replaceContent();

var thisIsMyWorks = true;
